home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / scheme / gjr / cmplrtst.lha / uuo.scm < prev    next >
Encoding:
Text File  |  1990-03-27  |  516 b   |  28 lines

  1. ;;; -*- Scheme -*-
  2.  
  3. #|
  4. Description:
  5.  
  6. Usage:
  7. (do-it 2 3) -> inapplicable object 1
  8. (with-mumble + (lambda () (do-it 2 3))) -> 5
  9. (do-it 2 3) -> inapplicable object 1
  10. (set! mumble do-it)
  11. (do-it 2 3) -> infinite loop
  12. (with-mumble + (lambda () (do-it 2 3))) -> 5
  13. (do-it 2 3) -> inifinite loop
  14. |#
  15.  
  16. (declare (usual-integrations))
  17.  
  18. (define mumble 1)
  19.  
  20. (define (with-mumble val thunk)
  21.   (let ((old mumble))
  22.     (set! mumble val)
  23.     (let ((res (thunk)))
  24.       (set! mumble old)
  25.       res)))
  26.  
  27. (define (do-it x y)
  28.   (mumble x y))